#ifndef __AgentI_H__
#define __AgentI_H__

#include <FIPA.h>
#include <Spammer.h>

#include <map>
#include <Ice/Ice.h>
#include <IceUtil/Mutex.h>
#include <IceStorm/IceStorm.h>
#include <IceGrid/Query.h>

using namespace std;

class AgentI: public virtual FIPA::Agent
{
 public:
  AgentI
    (Ice::Identity name,
     Ice::ObjectAdapterPtr oa);
  ~AgentI();
  
  virtual void setState
    (FIPA::AgentState, 
     const Ice::Current&);
  virtual FIPA::AgentState getState
    (const Ice::Current&);
  virtual void receiveMessage
    (const FIPA::Message&, 
     const Ice::Current&);
  virtual void dfAdv
    (FIPA::DFAction,
     const FIPA::DfAgentDescription&, 
     const Ice::Current&);
  virtual void destroy
    (const Ice::Current&);

  bool isZombie();

 protected:
  Ice::Identity _name;
  FIPA::AgentState _state;
  IceUtil::Mutex _m;
  bool _destroyed;

  FIPA::AMSPrx _ams;
  FIPA::MTSPrx _mts;
  FIPA::DFPrx _df;
};

typedef IceUtil::Handle<AgentI> AgentIPtr;

#endif
